// 提交
var uname = document.querySelector('#uname')
var tel = document.querySelector('#tel')
var email = document.querySelector('#email')
var youTex = document.querySelector('#you')
var submit = document.querySelector("#submit")
var moboleReg = /^1[0-9]{10}$/
var emailReg = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/
submit.addEventListener('click', function () {
    if (!uname.value) {
        alert('请填写您的姓名')
        return false
    }
    if (!tel.value) {
        alert('请填写您的电话')
        return false
    } else {
        if (!moboleReg.test(tel.value)) {
            alert('手机号格式不对')
            return false
        }
    }
    if (!email.value) {
        alert('请填写您的邮箱')
        return false
    } else {
        if (!emailReg.test(email.value)) {
            alert('邮箱格式不对')
            return false
        }
    }
    if (!youTex.value) {
        alert('请填写您的需求')
        return false
    }
    alert('您已提交成功')
    uname.value = ''
    tel.value = ''
    email.value = ''
    youTex.value = ''
})
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?b195007d7ea45d320220122acdf034c1";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();